var a = getApp();

Page({
    data: {
        active: 0,
        type_nickName: "律所",
        office_info: {},
        lawyer_info: {},
        enterprise_info: {},
        domainName: []
    },
    onLoad: function(a) {
        this.getData();
    },
    onShareAppMessage: function() {
        var a = "", t = "", e = wx.getStorageSync("uid");
        return "律所" == this.data.type_nickName ? (a = "邀请律所", t = "/packageI/lawyerPlatform/info/info?type=officedetail&share=office&merchant_member_id=" + e) : "律师" == this.data.type_nickName ? (a = "邀请律师", 
        t = "/packageI/lawyerPlatform/info/info?type=lawyerdetail&share=lawyer&merchant_member_id=" + e) : (a = "邀请企业", 
        t = "/packageI/lawyerPlatform/enterprise/add/add?type=add&share=enterprise&merchant_member_id=" + e), 
        {
            title: a,
            path: t
        };
    },
    getData: function() {
        var t = this, e = "";
        e = "律所" == this.data.type_nickName ? a.getNetAddresss("plugin.lawyer-platform.frontend.controllers.merchant.getLawyerFirm") : "律师" == this.data.type_nickName ? a.getNetAddresss("plugin.lawyer-platform.frontend.controllers.merchant.getLawyer") : a.getNetAddresss("plugin.lawyer-platform.frontend.controllers.business.getBusiness"), 
        a._postNetWork({
            url: e,
            success: function(e) {
                1 == e.data.result ? "律所" == t.data.type_nickName ? t.setData({
                    office_info: e.data.data.list
                }) : "律师" == t.data.type_nickName ? t.setData({
                    lawyer_info: e.data.data.list
                }) : t.setData({
                    enterprise_info: e.data.data.list
                }) : a.tips(e.data.msg);
            }
        });
    },
    onChange: function(a) {
        var t = a.detail;
        this.setData({
            active: t,
            type_nickName: t.title
        }), this.getData();
    },
    onReady: function() {},
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {
        if ("律所" == this.data.type_nickName) {
            if (this.data.office_info.current_page >= this.data.office_info.last_page) return !1;
            this.getMoreData();
        } else if ("律师" == this.data.type_nickName) {
            if (this.data.lawyer_info.current_page >= this.data.lawyer_info.last_page) return !1;
            this.getMoreData();
        } else if ("企业" == this.data.type_nickName) {
            if (console.log(this.data.enterprise_info.current_page >= this.data.enterprise_info.last_page), 
            this.data.enterprise_info.current_page >= this.data.enterprise_info.last_page) return !1;
            this.getMoreData();
        }
    },
    getMoreData: function() {
        var t = this, e = "", i = "";
        "律所" == this.data.type_nickName ? (e = a.getNetAddresss("plugin.lawyer-platform.frontend.controllers.merchant.getLawyerFirm"), 
        i = this.data.office_info.current_page + 1) : "律师" == this.data.type_nickName ? (e = a.getNetAddresss("plugin.lawyer-platform.frontend.controllers.merchant.getLawyer"), 
        i = this.data.lawyer_info.current_page + 1) : (e = a.getNetAddresss("plugin.lawyer-platform.frontend.controllers.business.getBusiness"), 
        i = this.data.enterprise_info.current_page + 1), a._postNetWork({
            url: e,
            data: {
                page: i
            },
            success: function(e) {
                1 == e.data.result ? "律所" == t.data.type_nickName ? (t.data.office_info.data.concat(e.data.data.list.data), 
                t.data.office_info.last_page = e.data.data.list.last_page, t.data.office_info.current_page = e.data.data.list.current_page, 
                t.setData({
                    office_info: t.data.office_info
                })) : "律师" == t.data.type_nickName ? (t.data.lawyer_info.data.concat(e.data.data.list.data), 
                t.data.lawyer_info.last_page = e.data.data.list.last_page, t.data.lawyer_info.current_page = e.data.data.list.current_page, 
                t.setData({
                    lawyer_info: t.data.lawyer_info
                })) : (t.data.enterprise_info.data.concat(e.data.data.list.data), t.data.enterprise_info.last_page = e.data.data.list.last_page, 
                t.data.enterprise_info.current_page = e.data.data.list.current_page, t.setData({
                    enterprise_info: t.data.enterprise_info
                })) : a.tips(e.data.msg);
            }
        });
    }
});